<?php
	
	
	$id = $_GET['idbpos'];
				
	$cType = new CType;
	
	$type = $cType ->CTypeDetail($id);
	
	$notification ="";
	if(isset($_GET['notification']))
	{
		$notification =constant($_GET['notification']);
	}
	
	if(is_array($type))
	{
		//tao list category cho nguoi dung` lua chon
		$listCategory='<select name="lCategories" id="input3">	';
		
		
		$category = new CCategory;
		$arrCategory = $category -> CCategoryList();
		

		if(is_array($arrCategory))
		{
			foreach ($arrCategory as $key => $value)
			{
				if(	$value['id'] == $type['id_category'])
				{
					$listCategory .='<option selected="selected" value="'.$value['id'].'" > '.$value['name'].' </option>';
				}
				else
				{
						$listCategory .='<option value="'.$value['id'].'"> '.$value['name'].' </option>';
				}
				
			}
		}
		
		if($type['status'] ==1)
		{
			$rdbtnStatus ='  <label><input type="radio" name="rdbtn_status" value="1" checked="checked" >Active</label>
							<br>
							<label><input type="radio" name="rdbtn_status" value="0" > Inactive </label>
							';
		}
		else
		{
			$rdbtnStatus =' <label><input type="radio" name="rdbtn_status" value="1"  >Active </label>
						<br>
						<label><input type="radio" name="rdbtn_status" value="0" checked="checked">Inactive </label>
						';
		}
	
	
		$listCategory .='</select>';
		//ket thuc tao list category 
		
		$mainContent = '<form action="processType.php" method="post" name="form1">
						
						<script type="text/javascript">
							bkLib.onDomLoaded(function() {
							new nicEditor({maxHeight : 200}).panelInstance("area");
							});
						</script>
		
						<div id="content2">
							
							<span style="font-size:10px;color:#FF0000;font-weight:bold;font-family:Arial, Helvetica, sans-serif">'.$notification.'</span>
						
							<input type="hidden" name ="showType" value="'.$type['id'].'">
							<table border="0" width="90%" style="position:relative" align = "center" >
							<tr>
								<td colspan="2" align="left" valign="middle" height="50px"> 
								 <img src="images/profile.png" style="float:left" border="0"/>
								<span class="mystyle1"> Edit this type </span>		 </td>
							</tr>
							<tr>
								<td><span class="mystyle2">Catergory <span>
								</td>
								<td>'.$listCategory.'
								</td>
							</tr>
							
							<tr>
								<td><span class="mystyle2">Name <span>
								</td>
								<td>
									<input id="input3" type="text" name="tf_name" value="'.$type['name'].'" >
								</td>
							</tr>
							
							<tr>
								<td valign="top"><span class="mystyle2">Description <span>
								</td>
								<td>
									
									<textarea cols="55" name="tf_description" id="area" style="height: 100px;">	'.$type['description'].'</textarea>
								</td>
							</tr>
							<tr>
								<td valign="top"><span class="mystyle2">Status<span>
								</td>
								<td>
									
									'.$rdbtnStatus.'
								</td>
							</tr>
							
							<tr align="center">
								<td colspan="2" height="50px">
									<input id="input2"  type="submit" name="btn_ok" value="  OK  ">
									<input id="input2" name="btn_cancel" type="submit" value="  Cancel  " >
								</td>
							</tr>
	 
							</table>
						</div>
						<input type="hidden" name = "hTypeAction" value ="edi">
						</form>';

	}


?>